(function(){
	angular.module('app').component('tableTopShopComponent',{
		templateUrl: 'app/controllers/industry.controller/table.top.shop.component/table.top.shop.component.html',
		controller: tableTopShopComponent,
		controllerAs: 'vm',
		bindings:{
			catName: '<'
		}
	});

	tableTopShopComponent.$inject = ['$scope','util','tableTopShopService','$rootScope'];

	function tableTopShopComponent($scope,util,tableTopShopService,$rootScope){
		var vm = this;

		vm.title = '';
		vm.shops = [];
		vm.addMonitor = tableTopShopService.addMonitor; //店铺监控
		vm.getShopDetail = getShopDetail;

		$scope.$watch('vm.catName',function(newValue,oldValue){
			// console.log('tableTopShopComponent:catName:'+newValue);
			vm.title = util.catNameFormat(newValue)+'类目店铺排行榜';
			tableTopShopService.get(newValue).then(function(shops){
				vm.shops = shops;
				
			});
		});

		function getShopDetail(shop,shopName){
			$rootScope.$emit('formShop_detail_EV', shop, shopName)
		}
	}
})();